package com.yuwen.yuwenRPC.protocol;


/**
 * 协议消息类型枚举类
 */
public enum ProtocolMessageTypeEnum {
    REQUEST(0),
    RESPONSE(1),
    HEART_BEAT(2),
    OTHER(3);
    ;


    private final int key;

    ProtocolMessageTypeEnum(int key) {
        this.key = key;
    }


    public static ProtocolMessageTypeEnum getEnumByKeY(int key) {
        for (ProtocolMessageTypeEnum e : ProtocolMessageTypeEnum.values()) {
            if (e.key == key) {
                return e;
            }
        }
        return null;
    }

    public int getKey() {
        return key;
    }
}
